Page({
  data: {
    list: [],
    allList: [],
    page: 0, // page起始页
    perPage: 5, // 每页最多显示条数
  },
  onLoad(options) {
    this.setData({
      allList: [
        1, 2, 3, 4, 5, 
        6, 7, 8, 9, 10, 
        11, 12, 13, 14, 15, 
        16, 17, 18, 19, 20,
        21, 22, 23, 24, 25,
      ],
    });
  },
  // 上拉加载更多，分页
  onReachBottom() {
    let { page, perPage, list, allList } = this.data;
    if (list.length < allList.length) {
      page++;
      let start = page * perPage;
      let end = (page + 1) * perPage;
      list = [...list, ...allList.slice(start, end)];
      this.setData({
        list,
        page,
      });
      // console.log(page);
    }
  },
});
